import server from "../util/request.js";


// 添加订单
export function addOrder(data) {
    return server({
        url: "/order/add",
        method: "POST",
        data
    })
}
// 获取订单子项
export function findOrderDetail(orderId) {
    return server({
        url: `/order/detail/${orderId}`,
        method: "GET"
    })
}

// 修改订单
export function editOrder(data) {
    return server({
        url: "/order/edit",
        method: "PUT",
        data
    })
}

// 获取订单修改信息
export function getOrderForEdit(orderId) {
    return server({
        url: `/order/edit/${orderId}`,
        method: "GET"
    })
}

// 搜索订单
export function findSearchOrders(data) {
    return server({
        url: "/order/search",
        method: "POST",
        data
    })
}
export function findSearchOrdersReturn(data) {
    return server({
        url: "/order/search/return",
        method: "POST",
        data
    })
}

// 删除订单（逻辑删除）
export function deleteOrder(orderId) {
    return server({
        url: `/order/${orderId}`,
        method: "DELETE"
    })
}
// 订单审批
export function orderApproval(data) {
    return server({
        url: `/order/approval`,
        method: "POST",
        data
    })
}
// 订单导出
export function orderExport() {
    return server({
        url: `/order/export`,
        method: "GET",
        responseType: 'blob', // 接受二进制流
    })
}
// 订单退货
export function orderReturn(data) {
    return server({
        url: `/order/return`,
        method: "PUT",
        data
    })
}
